<?php
namespace BP\Sys;

use BP\En\EntityNoName;

require_once("BP/En/Map.php");
class MapDtl extends EntityNoName {
	public $HisGEDtls_temp;	// GEDtls
	public $_IsReadonly;	// int
	public $IsUse;	// boolean
	private function __init() { // default class members
		$this->HisGEDtls_temp = NULL;
		$this->_IsReadonly = 2;
		$this->IsUse =  FALSE ;
	}
	public function getRefPK () 
	{
		$str = $this->GetValStrByKey(MapDtlAttr::$RefPK);
		if ($DataType->IsNullOrEmpty($str))
		{
			return "RefPK";
		}
		return $str;
	}
	public function setRefPK ($value) // [String value]
	{
		$this->SetValByKey(MapDtlAttr::$RefPK, $value);
	}
	public function getRowIdx () 
	{
		return $this->GetValIntByKey(MapDtlAttr::$RowIdx);
	}
	public function setRowIdx ($value) // [int value]
	{
		$this->SetValByKey(MapDtlAttr::$RowIdx, $value);
	}
	public function getIsExp () 
	{
		return $this->GetValBooleanByKey(MapDtlAttr::$IsExp);
	}
	public function setIsExp ($value) // [boolean value]
	{
		$this->SetValByKey(MapDtlAttr::$IsExp, $value);
	}
	public function getFEBD () 
	{
		return $this->GetValStringByKey(MapDtlAttr::$FEBD);
	}
	public function setFEBD ($value) // [String value]
	{
		$this->SetValByKey(MapDtlAttr::$FEBD, $value);
	}
	public function getImpModel () 
	{
		return $this->GetValIntByKey(MapDtlAttr::$ImpModel);
	}
	public function setImpModel ($value) // [int value]
	{
		$this->SetValByKey(MapDtlAttr::$ImpModel, $value);
	}
	public function getImpSQLInit () 
	{
		return $this->GetValStringByKey(MapDtlAttr::$ImpSQLInit)->replace("~", "'");
	}
	public function setImpSQLInit ($value) // [String value]
	{
		$this->SetValByKey(MapDtlAttr::$ImpSQLInit, $value);
	}
	public function getImpSQLSearch () 
	{
		return $this->GetValStringByKey(MapDtlAttr::$ImpSQLSearch)->replace("~", "'");
	}
	public function setImpSQLSearch ($value) // [String value]
	{
		$this->SetValByKey(MapDtlAttr::$ImpSQLSearch, $value);
	}
	public function getImpSQLFullOneRow () 
	{
		return $this->GetValStringByKey(MapDtlAttr::$ImpSQLFullOneRow)->replace("~", "'");
	}
	public function setImpSQLFullOneRow ($value) // [String value]
	{
		$this->SetValByKey(MapDtlAttr::$ImpSQLFullOneRow, $value);
	}
	public function getDtlModel () 
	{
		return DtlModel->forValue($this->GetValIntByKey(MapDtlAttr::$Model));
	}
	public function setDtlModel ($value) // [DtlModel value]
	{
		$this->SetValByKey(MapDtlAttr::$Model, $value->getValue());
	}
	public function getIsRowLock () 
	{
		return $this->GetParaBoolen(MapDtlAttr::$IsRowLock,  FALSE );
	}
	public function setIsRowLock ($value) // [boolean value]
	{
		$this->SetPara(MapDtlAttr::$IsRowLock, $value);
	}
	public function getDtlAddRecModel () 
	{
		return DtlAddRecModel->forValue($this->GetParaInt(MapDtlAttr::$DtlAddRecModel));
	}
	public function setDtlAddRecModel ($value) // [DtlAddRecModel value]
	{
		$this->SetPara(MapDtlAttr::$DtlAddRecModel, $value->getValue());
	}
	public function getDtlSaveModel () 
	{
		return DtlSaveModel->forValue($this->GetParaInt(MapDtlAttr::$DtlSaveModel));
	}
	public function setDtlSaveModel ($value) // [DtlSaveModel value]
	{
		$this->SetPara(MapDtlAttr::$DtlSaveModel, $value->getValue());
	}
	public function getIsEnableLink () 
	{
		return $this->GetParaBoolen(MapDtlAttr::$IsEnableLink,  FALSE );
	}
	public function setIsEnableLink ($value) // [boolean value]
	{
		$this->SetPara(MapDtlAttr::$IsEnableLink, $value);
	}
	public function getLinkLabel () 
	{
		$s = $this->GetParaString(MapDtlAttr::$LinkLabel);
		if ($DataType->IsNullOrEmpty($s))
		{
			return "详细";
		}
		return $s;
	}
	public function setLinkLabel ($value) // [String value]
	{
		$this->SetPara(MapDtlAttr::$LinkLabel, $value);
	}
	public function getLinkUrl () 
	{
		$s = $this->GetValStrByKey(MapDtlAttr::$LinkUrl);
		if ($DataType->IsNullOrEmpty($s))
		{
			return "http://ccport.org";
		}
		return $s;
	}
	public function setLinkUrl ($value) // [String value]
	{
		$this->SetValByKey(MapDtlAttr::$LinkUrl, $value);
	}
	public function getLinkTarget () 
	{
		$s = $this->GetParaString(MapDtlAttr::$LinkTarget);
		if ($DataType->IsNullOrEmpty($s))
		{
			return "_blank";
		}
		return $s;
	}
	public function setLinkTarget ($value) // [String value]
	{
		$this->SetPara(MapDtlAttr::$LinkTarget, $value);
	}
	public function getSubThreadWorker () 
	{
		$s = $this->GetParaString(MapDtlAttr::$SubThreadWorker);
		if ($DataType->IsNullOrEmpty($s))
		{
			return "";
		}
		return $s;
	}
	public function setSubThreadWorker ($value) // [String value]
	{
		$this->SetPara(MapDtlAttr::$SubThreadWorker, $value);
	}
	public function getSubThreadGroupMark () 
	{
		$s = $this->GetParaString(MapDtlAttr::$SubThreadGroupMark);
		if ($DataType->IsNullOrEmpty($s))
		{
			return "";
		}
		return $s;
	}
	public function setSubThreadGroupMark ($value) // [String value]
	{
		$this->SetPara(MapDtlAttr::$SubThreadGroupMark, $value);
	}
	public function getFK_Node () 
	{
		return $this->GetValIntByKey(MapDtlAttr::$FK_Node);
	}
	public function setFK_Node ($value) // [int value]
	{
		$this->SetValByKey(MapDtlAttr::$FK_Node, $value);
	}
	public function getMapFrames () 
	{
		$tempVar = $this->GetRefObject("MapFrames");
		$obj = ( ($tempVar instanceof MapFrames) ? $tempVar : NULL );
		if (($obj == NULL))
		{
			$obj = MapFrames::constructor__String($this->getNo());
			$this->SetRefObject("MapFrames", $obj);
		}
		return $obj;
	}
	public function getMapExts () 
	{
		$tempVar = $this->GetRefObject("MapExts");
		$obj = ( ($tempVar instanceof MapExts) ? $tempVar : NULL );
		if (($obj == NULL))
		{
			$obj = MapExts::constructor__String($this->getNo());
			$this->SetRefObject("MapExts", $obj);
		}
		return $obj;
	}
	public function getFrmEvents () 
	{
		$tempVar = $this->GetRefObject("FrmEvents");
		$obj = ( ($tempVar instanceof FrmEvents) ? $tempVar : NULL );
		if (($obj == NULL))
		{
			$obj = FrmEvents::constructor__I($this->getNo());
			$this->SetRefObject("FrmEvents", $obj);
		}
		return $obj;
	}
	public function getMapDtls () 
	{
		$tempVar = $this->GetRefObject("MapDtls");
		$obj = ( ($tempVar instanceof MapDtls) ? $tempVar : NULL );
		if (($obj == NULL))
		{
			$obj = MapDtls::constructor__String($this->getNo());
			$this->SetRefObject("MapDtls", $obj);
		}
		return $obj;
	}
	public function getFrmLinks () 
	{
		$tempVar = $this->GetRefObject("FrmLinks");
		$obj = ( ($tempVar instanceof FrmLinks) ? $tempVar : NULL );
		if (($obj == NULL))
		{
			$obj = FrmLinks::constructor__String($this->getNo());
			$this->SetRefObject("FrmLinks", $obj);
		}
		return $obj;
	}
	public function getFrmBtns () 
	{
		$tempVar = $this->GetRefObject("FrmLinks");
		$obj = ( ($tempVar instanceof FrmBtns) ? $tempVar : NULL );
		if (($obj == NULL))
		{
			$obj = FrmBtns::constructor__String($this->getNo());
			$this->SetRefObject("FrmBtns", $obj);
		}
		return $obj;
	}
	public function getFrmEles () 
	{
		$tempVar = $this->GetRefObject("FrmEles");
		$obj = ( ($tempVar instanceof FrmEles) ? $tempVar : NULL );
		if (($obj == NULL))
		{
			$obj = FrmEles::constructor__String($this->getNo());
			$this->SetRefObject("FrmEles", $obj);
		}
		return $obj;
	}
	public function getFrmLines () 
	{
		$tempVar = $this->GetRefObject("FrmLines");
		$obj = ( ($tempVar instanceof FrmLines) ? $tempVar : NULL );
		if (($obj == NULL))
		{
			$obj = FrmLines::constructor__String($this->getNo());
			$this->SetRefObject("FrmLines", $obj);
		}
		return $obj;
	}
	public function getFrmLabs () 
	{
		$tempVar = $this->GetRefObject("FrmLabs");
		$obj = ( ($tempVar instanceof FrmLabs) ? $tempVar : NULL );
		if (($obj == NULL))
		{
			$obj = FrmLabs::constructor__String($this->getNo());
			$this->SetRefObject("FrmLabs", $obj);
		}
		return $obj;
	}
	public function getFrmImgs () 
	{
		$tempVar = $this->GetRefObject("FrmLabs");
		$obj = ( ($tempVar instanceof FrmImgs) ? $tempVar : NULL );
		if (($obj == NULL))
		{
			$obj = FrmImgs::constructor__String($this->getNo());
			$this->SetRefObject("FrmLabs", $obj);
		}
		return $obj;
	}
	public function getFrmAttachments () 
	{
		$tempVar = $this->GetRefObject("FrmAttachments");
		$obj = ( ($tempVar instanceof FrmAttachments) ? $tempVar : NULL );
		if (($obj == NULL))
		{
			$obj = FrmAttachments::constructor__String($this->getNo());
			$this->SetRefObject("FrmAttachments", $obj);
		}
		return $obj;
	}
	public function getFrmImgAths () 
	{
		$tempVar = $this->GetRefObject("FrmImgAths");
		$obj = ( ($tempVar instanceof FrmImgAths) ? $tempVar : NULL );
		if (($obj == NULL))
		{
			$obj = FrmImgAths::constructor__String($this->getNo());
			$this->SetRefObject("FrmImgAths", $obj);
		}
		return $obj;
	}
	public function getFrmRBs () 
	{
		$tempVar = $this->GetRefObject("FrmRBs");
		$obj = ( ($tempVar instanceof FrmRBs) ? $tempVar : NULL );
		if (($obj == NULL))
		{
			$obj = FrmRBs::constructor__String($this->getNo());
			$this->SetRefObject("FrmRBs", $obj);
		}
		return $obj;
	}
	public function getMapAttrs () 
	{
		$tempVar = $this->GetRefObject("MapAttrs");
		$obj = ( ($tempVar instanceof MapAttrs) ? $tempVar : NULL );
		if (($obj == NULL))
		{
			$obj = MapAttrs::constructor__String($this->getNo());
			$this->SetRefObject("MapAttrs", $obj);
		}
		return $obj;
	}
	public function getHisEditModel () 
	{
		return EditModel->forValue($this->GetValIntByKey(MapDtlAttr::$EditModel));
	}
	public function setHisEditModel ($value) // [EditModel value]
	{
		$this->SetValByKey(MapDtlAttr::$EditModel, $value->getValue());
	}
	public function getHisWhenOverSize () 
	{
		return WhenOverSize->forValue($this->GetValIntByKey(MapDtlAttr::$WhenOverSize));
	}
	public function setHisWhenOverSize ($value) // [WhenOverSize value]
	{
		$this->SetValByKey(MapDtlAttr::$WhenOverSize, $value->getValue());
	}
	public function getIsShowSum () 
	{
		return $this->GetValBooleanByKey(MapDtlAttr::$IsShowSum);
	}
	public function setIsShowSum ($value) // [boolean value]
	{
		$this->SetValByKey(MapDtlAttr::$IsShowSum, $value);
	}
	public function getIsShowIdx () 
	{
		return $this->GetValBooleanByKey(MapDtlAttr::$IsShowIdx);
	}
	public function setIsShowIdx ($value) // [boolean value]
	{
		$this->SetValByKey(MapDtlAttr::$IsShowIdx, $value);
	}
	public function getIsShowTitle () 
	{
		return $this->GetValBooleanByKey(MapDtlAttr::$IsShowTitle);
	}
	public function setIsShowTitle ($value) // [boolean value]
	{
		$this->SetValByKey(MapDtlAttr::$IsShowTitle, $value);
	}
	public function getIsHLDtl () 
	{
		return $this->GetValBooleanByKey(MapDtlAttr::$IsHLDtl);
	}
	public function setIsHLDtl ($value) // [boolean value]
	{
		$this->SetValByKey(MapDtlAttr::$IsHLDtl, $value);
	}
	public function getIsFLDtl () 
	{
		return $this->GetParaBoolen(MapDtlAttr::$IsFLDtl);
	}
	public function setIsFLDtl ($value) // [boolean value]
	{
		$this->SetPara(MapDtlAttr::$IsFLDtl, $value);
	}
	public function getIsReadonly () 
	{
		if (($this->_IsReadonly != 2))
		{
			if (($this->_IsReadonly == 1))
			{
				return  TRUE ;
			}
			else
			{
				return  FALSE ;
			}
		}
		if ((($this->getIsDelete() || $this->getIsInsert()) || $this->getIsUpdate()))
		{
			$this->_IsReadonly = 0;
			return  FALSE ;
		}
		$this->_IsReadonly = $this->GetValIntByKey(MapDtlAttr::$IsReadonly);
		return $this->GetValBooleanByKey(MapDtlAttr::$IsReadonly);
	}
	public function setIsReadonly ($value) // [boolean value]
	{
		$this->SetValByKey(MapDtlAttr::$IsReadonly, $value);
	}
	public function getIsDelete () 
	{
		return $this->GetValBooleanByKey(MapDtlAttr::$IsDelete);
	}
	public function setIsDelete ($value) // [boolean value]
	{
		$this->SetValByKey(MapDtlAttr::$IsDelete, $value);
	}
	public function getIsInsert () 
	{
		return $this->GetValBooleanByKey(MapDtlAttr::$IsInsert);
	}
	public function setIsInsert ($value) // [boolean value]
	{
		$this->SetValByKey(MapDtlAttr::$IsInsert, $value);
	}
	public function getIsView () 
	{
		return $this->GetValBooleanByKey(MapDtlAttr::$IsView);
	}
	public function setIsView ($value) // [boolean value]
	{
		$this->SetValByKey(MapDtlAttr::$IsView, $value);
	}
	public function getIsUpdate () 
	{
		return $this->GetValBooleanByKey(MapDtlAttr::$IsUpdate);
	}
	public function setIsUpdate ($value) // [boolean value]
	{
		$this->SetValByKey(MapDtlAttr::$IsUpdate, $value);
	}
	public function getIsEnableAthM () 
	{
		return $this->GetValBooleanByKey(MapDtlAttr::$IsEnableAthM);
	}
	public function setIsEnableAthM ($value) // [boolean value]
	{
		$this->SetValByKey(MapDtlAttr::$IsEnableAthM, $value);
	}
	public function getIsEnableGroupField () 
	{
		return $this->GetValBooleanByKey(MapDtlAttr::$IsEnableGroupField);
	}
	public function setIsEnableGroupField ($value) // [boolean value]
	{
		$this->SetValByKey(MapDtlAttr::$IsEnableGroupField, $value);
	}
	public function getIsEnablePass () 
	{
		return $this->GetValBooleanByKey(MapDtlAttr::$IsEnablePass);
	}
	public function setIsEnablePass ($value) // [boolean value]
	{
		$this->SetValByKey(MapDtlAttr::$IsEnablePass, $value);
	}
	public function getIsCopyNDData () 
	{
		return $this->GetValBooleanByKey(MapDtlAttr::$IsCopyNDData);
	}
	public function setIsCopyNDData ($value) // [boolean value]
	{
		$this->SetValByKey(MapDtlAttr::$IsCopyNDData, $value);
	}
	public function getIsEnableM2M () 
	{
		return $this->GetValBooleanByKey(MapDtlAttr::$IsEnableM2M);
	}
	public function setIsEnableM2M ($value) // [boolean value]
	{
		$this->SetValByKey(MapDtlAttr::$IsEnableM2M, $value);
	}
	public function getIsEnableM2MM () 
	{
		return $this->GetValBooleanByKey(MapDtlAttr::$IsEnableM2MM);
	}
	public function setIsEnableM2MM ($value) // [boolean value]
	{
		$this->SetValByKey(MapDtlAttr::$IsEnableM2MM, $value);
	}
	public function getDtlOpenType () 
	{
		return DtlOpenType->forValue($this->GetValIntByKey(MapDtlAttr::$DtlOpenType));
	}
	public function setDtlOpenType ($value) // [DtlOpenType value]
	{
		$this->SetValByKey(MapDtlAttr::$DtlOpenType, $value->getValue());
	}
	public function getGroupField () 
	{
		return $this->GetValStrByKey(MapDtlAttr::$GroupField);
	}
	public function setGroupField ($value) // [String value]
	{
		$this->SetValByKey(MapDtlAttr::$GroupField, $value);
	}
	public function getFK_MapData () 
	{
		return $this->GetValStrByKey(MapDtlAttr::$FK_MapData);
	}
	public function setFK_MapData ($value) // [String value]
	{
		$this->SetValByKey(MapDtlAttr::$FK_MapData, $value);
	}
	public function getPTableModel () 
	{
		return $this->GetParaInt("PTableModel");
	}
	public function setPTableModel ($value) // [int value]
	{
		$this->SetPara("PTableModel", $value);
	}
	public function getRowsOfList () 
	{
		if (($this->getIsInsert() ==  FALSE ))
		{
			return 0;
		}
		return $this->GetValIntByKey(MapDtlAttr::$RowsOfList);
	}
	public function setRowsOfList ($value) // [int value]
	{
		$this->SetValByKey(MapDtlAttr::$RowsOfList, $value);
	}
	public function getPTable () 
	{
		$s = $this->GetValStrByKey(MapDtlAttr::$PTable);
		if ((($s . NULL) . $s->equals("")))
		{
			$s = $this->getNo();
			if ($s->substring(0, 1)->equals("0"))
			{
				return ("T" . $this->getNo());
			}
			else
			{
				return $s;
			}
		}
		else
		{
			if ($s->substring(0, 1)->equals("0"))
			{
				return ("T" . $this->getNo());
			}
			else
			{
				return $s;
			}
		}
	}
	public function setPTable ($value) // [String value]
	{
		$this->SetValByKey(MapDtlAttr::$PTable, $value);
	}
	public function getFilterSQLExp () 
	{
		$s = $this->GetValStrByKey(MapDtlAttr::$FilterSQLExp);
		if (($DataType->IsNullOrEmpty($s) ==  TRUE ))
		{
			return "";
		}
		$s = $s->replace("~", "'");
		return $s->trim();
	}
	public function setFilterSQLExp ($value) // [String value]
	{
		$this->SetValByKey(MapDtlAttr::$FilterSQLExp, $value);
	}
	public function getMTR () 
	{
		$s = $this->GetValStrByKey(MapDtlAttr::$MTR);
		$s = $s->replace("�?", "<");
		$s = $s->replace("�?", ">");
		$s = $s->replace("�?", "'");
		return $s;
	}
	public function setMTR ($value) // [String value]
	{
		$s = $value;
		$s = $s->replace("<", "�?");
		$s = $s->replace(">", "�?");
		$s = $s->replace("'", "�?");
		$this->SetValByKey(MapDtlAttr::$MTR, $value);
	}
	public function getAlias () 
	{
		return $this->GetValStrByKey(MapDtlAttr::$Alias);
	}
	public function setAlias ($value) // [String value]
	{
		$this->SetValByKey(MapDtlAttr::$Alias, $value);
	}
	public function GenerMap () 
	{
		$isdebug = SystemConfig::getIsDebug();
		if (($isdebug ==  FALSE ))
		{
			$m =Cash->GetMap($this->getNo());
			if (($m != NULL))
			{
				return $m;
			}
		}
		$mapAttrs = $this->getMapAttrs();
		$map = new Map($this->getPTable(), $this->getName());
		$map->Java_SetEnType($EnType->App);
		$map->Java_SetDepositaryOfEntity($Depositary->None);
		$map->Java_SetDepositaryOfMap($Depositary->Application);
		$attrs = new Attrs();
		foreach ($mapAttrs->ToJavaList() as $mapAttr) 		{
			$map->AddAttr($mapAttr->getHisAttr());
		}
		Cash->SetMap($this->getNo(), $map);
		return $map;
	}
	public function getHisGEDtl () 
	{
		$dtl = GEDtl::constructor__String($this->getNo());
		return $dtl;
	}
	public function GenerGEMainEntity ($mainPK) // [String mainPK]
	{
		$en = GEEntity::constructor__String_Object($this->getFK_MapData(), $mainPK);
		return $en;
	}
	public static function constructor__ () 
	{
		$me = new self();
		$me->__init();
		return $me;
	}
	public static function constructor__String ($no) // [String no]
	{
		$me = new self();
		$me->__init();
		$me->setNo($no);
		$me->_IsReadonly = 2;
		$me->Retrieve();
		return $me;
	}
	public function getEnMap () 
	{
		if (($this->get_enMap() != NULL))
		{
			return $this->get_enMap();
		}
		$map = new Map("Sys_MapDtl", "明细");
		$map->Java_SetDepositaryOfEntity($Depositary->None);
		$map->Java_SetEnType($EnType->Sys);
		$map->IndexField = MapDtlAttr::$FK_MapData;
		$map->AddTBStringPK(MapDtlAttr::$No, NULL, "编号",  TRUE ,  FALSE , 1, 100, 20);
		$map->AddTBString(MapDtlAttr::$Name, NULL, "描述",  TRUE ,  FALSE , 1, 200, 20);
		$map->AddTBString(MapDtlAttr::$Alias, NULL, "别名",  TRUE ,  FALSE , 1, 200, 20);
		$map->AddTBString(MapDtlAttr::$FK_MapData, NULL, "主表",  TRUE ,  FALSE , 0, 100, 20);
		$map->AddTBString(MapDtlAttr::$PTable, NULL, "物理�?",  TRUE ,  FALSE , 0, 200, 20);
		$map->AddTBString(MapDtlAttr::$GroupField, NULL, "分组字段",  TRUE ,  FALSE , 0, 300, 20);
		$map->AddTBString(MapDtlAttr::$RefPK, NULL, "关联的主�?",  TRUE ,  FALSE , 0, 100, 20);
		$map->AddTBString(MapDtlAttr::$FEBD, NULL, "映射的事件实体类",  TRUE ,  FALSE , 0, 100, 20);
		$map->AddDDLSysEnum(MapDtlAttr::$Model, 0, "工作模式",  TRUE ,  TRUE , MapDtlAttr::$Model, "@0=普�?�@1=固定�?");
		$map->AddTBInt(MapDtlAttr::$DtlVer, 0, "使用版本",  FALSE ,  FALSE );
		$map->AddTBInt(MapDtlAttr::$RowsOfList, 6, "初始化行�?",  FALSE ,  FALSE );
		$map->AddBoolean(MapDtlAttr::$IsEnableGroupField,  FALSE , "是否启用分组字段",  FALSE ,  FALSE );
		$map->AddBoolean(MapDtlAttr::$IsShowSum,  TRUE , "是否显示合计�?",  FALSE ,  FALSE );
		$map->AddBoolean(MapDtlAttr::$IsShowIdx,  TRUE , "是否显示序号�?",  FALSE ,  FALSE );
		$map->AddBoolean(MapDtlAttr::$IsCopyNDData,  TRUE , "是否允许Copy数据",  FALSE ,  FALSE );
		$map->AddBoolean(MapDtlAttr::$IsHLDtl,  FALSE , "是否是合流汇�?",  FALSE ,  FALSE );
		$map->AddBoolean(MapDtlAttr::$IsReadonly,  FALSE , "是否只读�?",  FALSE ,  FALSE );
		$map->AddBoolean(MapDtlAttr::$IsShowTitle,  TRUE , "是否显示标题�?",  FALSE ,  FALSE );
		$map->AddBoolean(MapDtlAttr::$IsView,  TRUE , "是否可见",  FALSE ,  FALSE );
		$map->AddBoolean(MapDtlAttr::$IsInsert,  TRUE , "是否可以插入行？",  FALSE ,  FALSE );
		$map->AddBoolean(MapDtlAttr::$IsDelete,  TRUE , "是否可以删除�?",  FALSE ,  FALSE );
		$map->AddBoolean(MapDtlAttr::$IsUpdate,  TRUE , "是否可以更新�?",  FALSE ,  FALSE );
		$map->AddBoolean(MapDtlAttr::$IsEnablePass,  FALSE , "是否启用通过审核功能?",  FALSE ,  FALSE );
		$map->AddBoolean(MapDtlAttr::$IsEnableAthM,  FALSE , "是否启用多附�?",  FALSE ,  FALSE );
		$map->AddBoolean(MapDtlAttr::$IsEnableM2M,  FALSE , "是否启用M2M",  FALSE ,  FALSE );
		$map->AddBoolean(MapDtlAttr::$IsEnableM2MM,  FALSE , "是否启用M2M",  FALSE ,  FALSE );
		$map->AddTBInt(MapDtlAttr::$WhenOverSize, 0, "列表数据显示格式",  FALSE ,  FALSE );
		$map->AddTBInt(MapDtlAttr::$DtlOpenType, 1, "数据�?放类�?",  FALSE ,  FALSE );
		$map->AddTBInt(MapDtlAttr::$ListShowModel, 0, "列表数据显示格式",  FALSE ,  FALSE );
		$map->AddTBInt(MapDtlAttr::$EditModel, 0, "行数据显示格�?",  FALSE ,  FALSE );
		$map->AddTBInt(MapDtlAttr::$MobileShowModel, 0, "移动端数据显示格�?",  FALSE ,  FALSE );
		$map->AddTBString(MapDtlAttr::$MobileShowField, NULL, "移动端列表显示字�?",  TRUE ,  FALSE , 0, 100, 20);
		$map->AddTBFloat(MapDtlAttr::$X, 5, "距左",  TRUE ,  FALSE );
		$map->AddTBFloat(MapDtlAttr::$Y, 5, "距上",  FALSE ,  FALSE );
		$map->AddTBFloat(MapDtlAttr::$H, 150, "高度",  TRUE ,  FALSE );
		$map->AddTBFloat(MapDtlAttr::$W, 200, "宽度",  FALSE ,  FALSE );
		$map->AddTBFloat(MapDtlAttr::$FrmW, 900, "表单宽度",  TRUE ,  TRUE );
		$map->AddTBFloat(MapDtlAttr::$FrmH, 1200, "表单高度",  TRUE ,  TRUE );
		$map->AddTBString(MapDtlAttr::$MTR, NULL, "多表头列",  TRUE ,  FALSE , 0, 3000, 20);
		$map->AddBoolean(MapDtlAttr::$IsEnableLink,  FALSE , "是否启用超链�?",  TRUE ,  TRUE );
		$map->AddTBString(MapDtlAttr::$LinkLabel, "", "超连接标�?",  TRUE ,  FALSE , 0, 50, 100);
		$map->AddTBString(MapDtlAttr::$LinkTarget, NULL, "连接目标",  TRUE ,  FALSE , 0, 10, 100);
		$map->AddTBString(MapDtlAttr::$LinkUrl, NULL, "连接URL",  TRUE ,  FALSE , 0, 200, 200,  TRUE );
		$map->AddTBString(MapDtlAttr::$FilterSQLExp, NULL, "过滤SQL表达�?",  TRUE ,  FALSE , 0, 200, 20,  TRUE );
		$map->AddTBInt(MapDtlAttr::$FK_Node, 0, "节点(用户独立表单权限控制)",  FALSE ,  FALSE );
		$map->AddTBString(MapDtlAttr::$ShowCols, NULL, "显示的列",  TRUE ,  FALSE , 0, 500, 20,  TRUE );
		$map->SetHelperAlert(MapDtlAttr::$ShowCols, "默认为空,全部显示,如果配置了就按照配置的计�?,格式�?:field1,field2");
		$map->AddBoolean(MapDtlAttr::$IsExp,  TRUE , "IsExp",  FALSE ,  FALSE );
		$map->AddTBInt(MapDtlAttr::$ImpModel, 0, "导入规则",  FALSE ,  FALSE );
		$map->AddTBString(MapDtlAttr::$ImpSQLSearch, NULL, "查询SQL",  TRUE ,  FALSE , 0, 500, 20);
		$map->AddTBString(MapDtlAttr::$ImpSQLInit, NULL, "初始化SQL",  TRUE ,  FALSE , 0, 500, 20);
		$map->AddTBString(MapDtlAttr::$ImpSQLFullOneRow, NULL, "数据填充SQL",  TRUE ,  FALSE , 0, 500, 20);
		$map->AddTBString(MapDtlAttr::$ImpSQLNames, NULL, "字段中文�?",  TRUE ,  FALSE , 0, 900, 20);
		$map->AddTBString(MapDtlAttr::$ColAutoExp, NULL, "列自动计算表达式",  TRUE ,  FALSE , 0, 200, 20,  TRUE );
		$map->AddTBString(MapDtlAttr::$GUID, NULL, "GUID",  FALSE ,  FALSE , 0, 128, 20);
		$map->AddTBAtParas(300);
		$this->set_enMap($map);
		return $this->get_enMap();
	}
	public function getX () 
	{
		return $this->GetValFloatByKey(FrmImgAttr::$X);
	}
	public function setX ($value) // [float value]
	{
		$this->SetValByKey(MapDtlAttr::$X, $value);
	}
	public function getY () 
	{
		return $this->GetValFloatByKey(FrmImgAttr::$Y);
	}
	public function setY ($value) // [float value]
	{
		$this->SetValByKey(MapDtlAttr::$Y, $value);
	}
	public function getW () 
	{
		return $this->GetValFloatByKey(FrmImgAttr::$W);
	}
	public function setW ($value) // [float value]
	{
		$this->SetValByKey(MapDtlAttr::$W, $value);
	}
	public function getH () 
	{
		return $this->GetValFloatByKey(FrmImgAttr::$H);
	}
	public function setH ($value) // [float value]
	{
		$this->SetValByKey(MapDtlAttr::$H, $value);
	}
	public function getFrmW () 
	{
		return $this->GetValFloatByKey(MapDtlAttr::$FrmW);
	}
	public function getFrmH () 
	{
		return $this->GetValFloatByKey(MapDtlAttr::$FrmH);
	}
	public function GetCountByFK_I ($workID) // [int workID]
	{
		returnDBAccess->RunSQLReturnValInt(((("select COUNT(OID) from " . $this->getPTable()) . " WHERE WorkID=") . $workID));
	}
	public function GetCountByFK_String_String ($field, $val) // [String field, String val]
	{
		returnDBAccess->RunSQLReturnValInt((((((("select COUNT(OID) from " . $this->getPTable()) . " WHERE ") . $field) . "='") . $val) . "'"));
	}
	public function GetCountByFK_String_L ($field, $val) // [String field, long val]
	{
		returnDBAccess->RunSQLReturnValInt(((((("select COUNT(OID) from " . $this->getPTable()) . " WHERE ") . $field) . "=") . $val));
	}
	public function GetCountByFK_String_L_String_String ($f1, $val1, $f2, $val2) // [String f1, long val1, String f2, String val2]
	{
		returnDBAccess->RunSQLReturnValInt((((((((((("SELECT COUNT(OID) from " . $this->getPTable()) . " WHERE ") . $f1) . "=") . $val1) . " AND ") . $f2) . "='") . $val2) . "'"));
	}
	public function IntMapAttrs () 
	{
		$md = MapData::constructor__();
		$md->setNo($this->getNo());
		if (($md->RetrieveFromDBSources() == 0))
		{
			$md->setName($this->getName());
			$md->Insert();
		}
		$attrs = MapAttrs::constructor__String($this->getNo());
		$attr = MapAttr::constructor__();
		if (($attrs->Contains(MapAttrAttr::$KeyOfEn, "OID") ==  FALSE ))
		{
			$attr = MapAttr::constructor__();
			$attr->setFK_MapData($this->getNo());
			$attr->setHisEditType($EditType->Readonly);
			$attr->setKeyOfEn("OID");
			$attr->setName("主键");
			$attr->setMyDataType(DataType->AppInt);
			$attr->setUIContralType($UIContralType->TB);
			$attr->setLGType($FieldTypeS->Normal);
			$attr->setUIVisible( FALSE );
			$attr->setUIIsEnable( FALSE );
			$attr->setDefVal("0");
			$attr->Insert();
		}
		if (($attrs->Contains(MapAttrAttr::$KeyOfEn, "RefPK") ==  FALSE ))
		{
			$attr = MapAttr::constructor__();
			$attr->setFK_MapData($this->getNo());
			$attr->setHisEditType($EditType->Readonly);
			$attr->setKeyOfEn("RefPK");
			$attr->setName("关联ID");
			$attr->setMyDataType(DataType->AppString);
			$attr->setUIContralType($UIContralType->TB);
			$attr->setLGType($FieldTypeS->Normal);
			$attr->setUIVisible( FALSE );
			$attr->setUIIsEnable( FALSE );
			$attr->setDefVal("0");
			$attr->Insert();
		}
		if (($attrs->Contains(MapAttrAttr::$KeyOfEn, "FID") ==  FALSE ))
		{
			$attr = MapAttr::constructor__();
			$attr->setFK_MapData($this->getNo());
			$attr->setHisEditType($EditType->Readonly);
			$attr->setKeyOfEn("FID");
			$attr->setName("FID");
			$attr->setMyDataType(DataType->AppInt);
			$attr->setUIContralType($UIContralType->TB);
			$attr->setLGType($FieldTypeS->Normal);
			$attr->setUIVisible( FALSE );
			$attr->setUIIsEnable( FALSE );
			$attr->setDefVal("0");
			$attr->Insert();
		}
		if (($attrs->Contains(MapAttrAttr::$KeyOfEn, "RDT") ==  FALSE ))
		{
			$attr = MapAttr::constructor__();
			$attr->setFK_MapData($this->getNo());
			$attr->setHisEditType($EditType->UnDel);
			$attr->setKeyOfEn("RDT");
			$attr->setName("记录时间");
			$attr->setMyDataType(DataType->AppDateTime);
			$attr->setUIContralType($UIContralType->TB);
			$attr->setLGType($FieldTypeS->Normal);
			$attr->setUIVisible( FALSE );
			$attr->setUIIsEnable( FALSE );
			$attr->setTag("1");
			$attr->Insert();
		}
		if (($attrs->Contains(MapAttrAttr::$KeyOfEn, "Rec") ==  FALSE ))
		{
			$attr = MapAttr::constructor__();
			$attr->setFK_MapData($this->getNo());
			$attr->setHisEditType($EditType->Readonly);
			$attr->setKeyOfEn("Rec");
			$attr->setName("记录�?");
			$attr->setMyDataType(DataType->AppString);
			$attr->setUIContralType($UIContralType->TB);
			$attr->setLGType($FieldTypeS->Normal);
			$attr->setUIVisible( FALSE );
			$attr->setUIIsEnable( FALSE );
			$attr->setMaxLen(20);
			$attr->setMinLen(0);
			$attr->setDefVal("@WebUser.getNo()");
			$attr->setTag("@WebUser.getNo()");
			$attr->Insert();
		}
	}
	protected function InitExtMembers () 
	{
		if (($this->getIsEnableAthM() ==  TRUE ))
		{
			$athDesc = FrmAttachment::constructor__();
			$athDesc->setMyPK(($this->getNo() . "_AthMDtl"));
			if (($athDesc->RetrieveFromDBSources() == 0))
			{
				$athDesc->setFK_MapData($this->getNo());
				$athDesc->setNoOfObj("AthMDtl");
				$athDesc->setName($this->getName());
				$athDesc->DirectInsert();
				$group = GroupField::constructor__();
				$group->setLab($athDesc->getName());
				$group->setFrmID($this->getFK_MapData());
				$group->setCtrlType("Ath");
				$group->setCtrlID($athDesc->getMyPK());
				$group->setIdx(10);
				$group->Insert();
			}
		}
	}
	protected function beforeInsert () 
	{
		$gf = GroupField::constructor__();
		if (($gf->IsExit(GroupFieldAttr::$CtrlID, $this->getNo()) ==  FALSE ))
		{
			$gf->setFrmID($this->getFK_MapData());
			$gf->setCtrlID($this->getNo());
			$gf->setCtrlType("Dtl");
			$gf->setLab($this->getName());
			$gf->setIdx(0);
			$gf->Insert();
		}
		if ((($DataType->IsNullOrEmpty($this->getPTable()) ==  TRUE ) && ($this->getNo()->contains("ND") ==  TRUE )))
		{
			if (($this->getNo()->contains("01Dtl") ==  FALSE ))
			{
				$ptable = ($this->getNo()->substring(0, $this->getNo()->indexOf("01Dtl")) + $this->getNo()->substring($this->getNo()->indexOf("01Dtl")));
				$this->setPTable($ptable);
			}
		}
		return parent->beforeInsert();
	}
	protected function beforeUpdateInsertAction () 
	{
		$this->InitExtMembers();
		$md = MapData::constructor__();
		$md->setNo($this->getNo());
		if (($md->RetrieveFromDBSources() == 0))
		{
			$md->setName($this->getName());
			$md->Insert();
		}
		if (($this->getIsRowLock() ==  TRUE ))
		{
			$attrs = MapAttrs::constructor__String($this->getNo());
			if (($attrs->Contains(MapAttrAttr::$KeyOfEn, "IsRowLock") ==  FALSE ))
			{
				throw new \RuntimeException((("您启用了从表�?(" . $this->getName()) . ")行数据锁定功能，但是该从表里没IsRowLock字段，请参�?�帮助文档�??"));
			}
		}
		if ($this->getIsEnablePass())
		{
			$attrs = MapAttrs::constructor__String($this->getNo());
			if (($attrs->Contains(MapAttrAttr::$KeyOfEn, "IsPass") ==  FALSE ))
			{
				throw new \RuntimeException((("您启用了从表�?(" . $this->getName()) . ")条数据审核�?�项，但是该从表里没IsPass字段，请参�?�帮助文档�??"));
			}
		}
		return parent->beforeUpdateInsertAction();
	}
	protected function beforeUpdate () 
	{
		$attrs = MapAttrs::constructor__String($this->getNo());
		$isHaveEnable =  FALSE ;
		foreach ($attrs->ToJavaList() as $attr) 		{
			if (($attr->getUIIsEnable() && ($attr->getUIContralType() == $UIContralType->TB)))
			{
				$isHaveEnable =  TRUE ;
			}
		}
		$this->InitExtMembers();
		$md = MapData::constructor__();
		$md->setNo($this->getNo());
		$febd = Glo->GetFormDtlEventBaseByEnName($this->getNo());
		if (($febd == NULL))
		{
			$this->setFEBD("");
		}
		else
		{
			$this->setFEBD($febd);
		}
		if (($this->getPTable()->length() == 0))
		{
			$this->setPTable($this->getNo());
		}
		if (($md->RetrieveFromDBSources() == 1))
		{
			$md->setName($this->getName());
			$md->setPTable($this->getPTable());
			$md->setFK_FormTree("");
			$md->setFK_FrmSort("");
			$md->DirectUpdate();
		}
		return parent->beforeUpdate();
	}
	protected function beforeDelete () 
	{
		$sql = "";
		$sql += (("@DELETE FROM Sys_FrmLine WHERE FK_MapData='" . $this->getNo()) . "'");
		$sql += (("@DELETE FROM Sys_FrmLab WHERE FK_MapData='" . $this->getNo()) . "'");
		$sql += (("@DELETE FROM Sys_FrmLink WHERE FK_MapData='" . $this->getNo()) . "'");
		$sql += (("@DELETE FROM Sys_FrmImg WHERE FK_MapData='" . $this->getNo()) . "'");
		$sql += (("@DELETE FROM Sys_FrmImgAth WHERE FK_MapData='" . $this->getNo()) . "'");
		$sql += (("@DELETE FROM Sys_FrmRB WHERE FK_MapData='" . $this->getNo()) . "'");
		$sql += (("@DELETE FROM Sys_FrmAttachment WHERE FK_MapData='" . $this->getNo()) . "'");
		$sql += (("@DELETE FROM Sys_MapFrame WHERE FK_MapData='" . $this->getNo()) . "'");
		if (($this->getNo()->contains("BP.") ==  FALSE ))
		{
			$sql += (("@DELETE FROM Sys_MapExt WHERE FK_MapData='" . $this->getNo()) . "'");
		}
		$sql += (("@DELETE FROM Sys_MapAttr WHERE FK_MapData='" . $this->getNo()) . "'");
		$sql += (("@DELETE FROM Sys_MapData WHERE No='" . $this->getNo()) . "'");
		$sql += (("@DELETE FROM Sys_GroupField WHERE FrmID='" . $this->getNo()) . "'");
		$sql += (("@DELETE FROM Sys_GroupField WHERE CtrlID='" . $this->getNo()) . "'");
		DBAccess->RunSQLs($sql);
		if ((DBAccess->IsExitsObject($this->getPTable()) && ($this->getPTable()->indexOf("ND") == 0)))
		{
			$sql = (((("SELECT COUNT(No) AS NUM  FROM Sys_MapData WHERE PTable='" . $this->getPTable()) . "' OR ( PTable='' AND No='") . $this->getPTable()) . "')");
			$i = DBAccess->RunSQLReturnValInt($sql, 0);
			$sql = (((("SELECT COUNT(No) AS NUM  FROM Sys_MapDtl WHERE PTable='" . $this->getPTable()) . "' OR ( PTable='' AND No='") . $this->getPTable()) . "')");
			$i += DBAccess->RunSQLReturnValInt($sql, 0);
			if (($i >= 1))
			else
			{
				if ((DBAccess->RunSQLReturnValInt((("SELECT COUNT(*) FROM " . $this->getPTable()) . " WHERE 1=1 ")) == 0))
				{
					DBAccess::RunSQL(("DROP TABLE " . $this->getPTable()));
				}
			}
		}
		return parent->beforeDelete();
	}
}
?>
